<!doctype html>



  


<html class="theme-next mist use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>



<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />















  
  
  <link href="/blog/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/blog/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/blog/css/main.css?v=5.1.0" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="python," />








  <link rel="shortcut icon" type="image/x-icon" href="/blog/favicon.ico?v=5.1.0" />






<meta name="description" content="函数参数默认缺省值python中定义函数时，参数可以设置缺省值，调用时提供了参数值，使用提供的值；没有提供参数值则使用默认值。def fun(text, num=0):	print(&quot;text is %s, num is %d&quot; % (text, num))fun(&quot;niki&quot;)fun(&quot;niki&quot;,27)#运行结果&amp;gt; python testArgs.pytext is Niki, num">
<meta name="keywords" content="python">
<meta property="og:type" content="article">
<meta property="og:title" content="python中函数参数传递和可变长参数（\*args和\*\*kwargs）">
<meta property="og:url" content="https://gitee.com/shuhao/2018/02/27/python中函数参数传递和可变长参数（args和kwargs）/index.html">
<meta property="og:site_name" content="Niki">
<meta property="og:description" content="函数参数默认缺省值python中定义函数时，参数可以设置缺省值，调用时提供了参数值，使用提供的值；没有提供参数值则使用默认值。def fun(text, num=0):	print(&quot;text is %s, num is %d&quot; % (text, num))fun(&quot;niki&quot;)fun(&quot;niki&quot;,27)#运行结果&amp;gt; python testArgs.pytext is Niki, num">
<meta property="og:locale" content="zh-Hans">
<meta property="og:updated_time" content="2018-03-07T00:45:57.866Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="python中函数参数传递和可变长参数（\*args和\*\*kwargs）">
<meta name="twitter:description" content="函数参数默认缺省值python中定义函数时，参数可以设置缺省值，调用时提供了参数值，使用提供的值；没有提供参数值则使用默认值。def fun(text, num=0):	print(&quot;text is %s, num is %d&quot; % (text, num))fun(&quot;niki&quot;)fun(&quot;niki&quot;,27)#运行结果&amp;gt; python testArgs.pytext is Niki, num">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/blog/',
    scheme: 'Mist',
    sidebar: {"position":"right","display":"post","offset":12,"offset_float":0,"b2t":false,"scrollpercent":false},
    fancybox: true,
    motion: true,
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="https://gitee.com/shuhao/2018/02/27/python中函数参数传递和可变长参数（args和kwargs）/"/>





  <title> python中函数参数传递和可变长参数（\*args和\*\*kwargs） | Niki </title>
</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  





  <script type="text/javascript">
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?cb9f0585e406f878cb2f29c89ad3cdb7";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>










  
  
    
  

  <div class="container one-collumn sidebar-position-right page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/blog/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">Niki</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle">天道酬勤</p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/blog/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/blog/categories" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-categories"></i> <br />
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/blog/archives" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/blog/tags" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
    <link itemprop="mainEntityOfPage" href="https://gitee.com/shuhao/blog/2018/02/27/python中函数参数传递和可变长参数（args和kwargs）/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Fang ShuHao">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/blog/images/head.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Niki">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
            
            
              
                python中函数参数传递和可变长参数（\*args和\*\*kwargs）
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2018-02-27T19:28:12+08:00">
                2018-02-27
              </time>
            

            

            
          </span>

          
            <span class="post-category" >
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/blog/categories/python/" itemprop="url" rel="index">
                    <span itemprop="name">python</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
          

          
          

          

          

          

        </div>
      </header>
    


    <div class="post-body" itemprop="articleBody">

      
      

      
        <h2 id="函数参数默认缺省值"><a href="#函数参数默认缺省值" class="headerlink" title="函数参数默认缺省值"></a>函数参数默认缺省值</h2><p>python中定义函数时，参数可以设置缺省值，调用时提供了参数值，使用提供的值；没有提供参数值则使用默认值。<br><figure class="highlight python"><table><tr><td class="code"><pre><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">fun</span><span class="params">(text, num=<span class="number">0</span>)</span>:</span></span><br><span class="line">	print(<span class="string">"text is %s, num is %d"</span> % (text, num))</span><br><span class="line"></span><br><span class="line">fun(<span class="string">"niki"</span>)</span><br><span class="line">fun(<span class="string">"niki"</span>,<span class="number">27</span>)</span><br><span class="line"></span><br><span class="line"><span class="comment">#运行结果</span></span><br><span class="line">&gt; python testArgs.py</span><br><span class="line">text <span class="keyword">is</span> Niki, num <span class="keyword">is</span> <span class="number">0</span></span><br><span class="line">text <span class="keyword">is</span> Niki, num <span class="keyword">is</span> <span class="number">27</span></span><br></pre></td></tr></table></figure></p>
<h2 id="根据参数名传参"><a href="#根据参数名传参" class="headerlink" title="根据参数名传参"></a>根据参数名传参</h2><p>python中，可以根据参数的名字进行传参，而不需要按照参数定义的位置来传递<br><figure class="highlight python"><table><tr><td class="code"><pre><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">fun</span><span class="params">(arg1, arg2)</span>:</span></span><br><span class="line">	print(<span class="string">"arg1 is %s, arg2 is %s"</span> % (arg1, arg2))</span><br><span class="line"></span><br><span class="line">fun(<span class="string">"Niki"</span>,<span class="string">"python"</span>)</span><br><span class="line">fun(arg2= <span class="string">"python"</span>, arg1=<span class="string">"Niki"</span>)</span><br><span class="line"></span><br><span class="line"><span class="comment">#运行结果</span></span><br><span class="line">&gt; python testArgs.py</span><br><span class="line">arg1 <span class="keyword">is</span> Niki, arg2 <span class="keyword">is</span> python</span><br><span class="line">arg1 <span class="keyword">is</span> Niki, arg2 <span class="keyword">is</span> python</span><br><span class="line"></span><br><span class="line">`</span><br></pre></td></tr></table></figure></p>
<h2 id="变长函数定义"><a href="#变长函数定义" class="headerlink" title="变长函数定义"></a>变长函数定义</h2><p>在python中，我们经常看到这样的方法定义：<br><figure class="highlight python"><table><tr><td class="code"><pre><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">__hash__</span><span class="params">(self, *args, **kwargs)</span>:</span> <span class="comment"># real signature unknown</span></span><br><span class="line">    <span class="string">""" Return hash(self). """</span></span><br><span class="line">    <span class="keyword">pass</span></span><br></pre></td></tr></table></figure></p>
<p>那么*args 和 **kwargs的用法是什么？</p>
<h4 id="args"><a href="#args" class="headerlink" title="*args"></a>*args</h4><p>如果使用过java的同学肯定对方法定义中public void test(String… strs); “…”的用法非常熟悉。没错！*args也是和…的用法一样用于声明传递<strong><em>非命名键值可变长参数</em>列表</strong>的方法。<br>*args 声明参数的方式类似于一个列表参数。默认值为[]</p>
<h4 id="kwargs"><a href="#kwargs" class="headerlink" title="**kwargs"></a>**kwargs</h4><p>既然*args用来构造变长参数的方法，那么**kwargs又是干什么用的呢？其实**kwargs也是用来声明变长参数的，和*args不同的事，**kwargs用来声明传递<strong><em>键值可变长参数列表</em></strong>的方法<br>**kwargs声明参数的方式是一个字典参数</p>
<h4 id="非命名键值参数，-键值参数"><a href="#非命名键值参数，-键值参数" class="headerlink" title="非命名键值参数， 键值参数"></a>非命名键值参数， 键值参数</h4><p>那么什么是非命名键值参数，什么是键值参数？非命名键值参数其实就是和我们调用方法时传递的普通参数一样，而键值参数则是例如： fun(123, name=”Niki”)，方法调用中的 name=”Niki”就是键值参数。</p>
<p>我们来举个栗子看下上面的概念吧！</p>
<figure class="highlight python"><table><tr><td class="code"><pre><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">test</span><span class="params">(name, *args)</span>:</span></span><br><span class="line">    print(<span class="string">"name is %s"</span> % name)</span><br><span class="line">    <span class="keyword">for</span> arg <span class="keyword">in</span> args:</span><br><span class="line">        print(<span class="string">"非命名键值参数: "</span> + arg)</span><br><span class="line">    <span class="keyword">pass</span></span><br><span class="line"></span><br><span class="line">test(<span class="string">"Niki"</span>, <span class="string">"Hello"</span>,<span class="string">"Python"</span>)</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment">#运行结果</span></span><br><span class="line">&gt; python testArgs.py</span><br><span class="line">name <span class="keyword">is</span> Niki</span><br><span class="line">非命名键值参数: Hello</span><br><span class="line">非命名键值参数: Python</span><br></pre></td></tr></table></figure>
<figure class="highlight python"><table><tr><td class="code"><pre><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">test2</span><span class="params">(name, **kwargs)</span>:</span></span><br><span class="line">    print(<span class="string">"name is %s"</span> % name)</span><br><span class="line">    <span class="keyword">for</span> key <span class="keyword">in</span> kwargs:</span><br><span class="line">        print(<span class="string">"键值参数中key：%s,value：%s"</span> % (key, kwargs[key]))</span><br><span class="line">    <span class="keyword">pass</span></span><br><span class="line"></span><br><span class="line">test2(<span class="string">"Niki"</span>, adress=<span class="string">"sz"</span>, learn=<span class="string">"python"</span>)</span><br><span class="line"></span><br><span class="line"><span class="comment">#运行结果</span></span><br><span class="line">&gt; python testArgs.py</span><br><span class="line">name <span class="keyword">is</span> Niki</span><br><span class="line">键值参数中key：adress,value：sz</span><br><span class="line">键值参数中key：learn,value：python</span><br><span class="line"></span><br><span class="line">E:\workspace_py\test&gt;</span><br></pre></td></tr></table></figure>
<h2 id="变长函数调用"><a href="#变长函数调用" class="headerlink" title="变长函数调用"></a>变长函数调用</h2><p>相同的语法不仅局限于函数声明中使用，在函数调用中也有用到相同的语法。此时类似于extract package的效果。<br><figure class="highlight python"><table><tr><td class="code"><pre><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">test</span><span class="params">(name, *args)</span>:</span></span><br><span class="line">    print(<span class="string">"name is %s"</span> % name)</span><br><span class="line">    <span class="keyword">if</span> isinstance(args, tuple):</span><br><span class="line">        args = list(args)</span><br><span class="line">    <span class="keyword">for</span> arg <span class="keyword">in</span> args:</span><br><span class="line">        print(<span class="string">"非命名键值参数: "</span> + arg)</span><br><span class="line">    <span class="keyword">pass</span></span><br><span class="line"></span><br><span class="line">args = (<span class="string">"Hello"</span>, <span class="string">"Python"</span>)</span><br><span class="line">test(<span class="string">"Niki"</span>,args)</span><br><span class="line"></span><br><span class="line"><span class="comment">#运行结果</span></span><br><span class="line">&gt; python testArgs.py</span><br><span class="line">name <span class="keyword">is</span> Niki</span><br><span class="line">Traceback (most recent call last):</span><br><span class="line">  File <span class="string">"testArgs.py"</span>, line <span class="number">10</span>, <span class="keyword">in</span> &lt;module&gt;</span><br><span class="line">    test(<span class="string">"Niki"</span>,args)</span><br><span class="line">  File <span class="string">"testArgs.py"</span>, line <span class="number">6</span>, <span class="keyword">in</span> test</span><br><span class="line">    print(<span class="string">"非命名键值参数: "</span> + arg)</span><br><span class="line">TypeError: must be str, <span class="keyword">not</span> tuple</span><br></pre></td></tr></table></figure></p>
<p>可以看出如果为*args传递一个元组则程序抛异常，那么如果参数是一个元组能不能调用方法？该如何调用方法呢？<br><figure class="highlight python"><table><tr><td class="code"><pre><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">test</span><span class="params">(name, *args)</span>:</span></span><br><span class="line">    print(<span class="string">"name is %s"</span> % name)</span><br><span class="line">    <span class="keyword">if</span> isinstance(args, tuple):</span><br><span class="line">        args = list(args)</span><br><span class="line">    <span class="keyword">for</span> arg <span class="keyword">in</span> args:</span><br><span class="line">        print(<span class="string">"非命名键值参数: "</span> + arg)</span><br><span class="line">    <span class="keyword">pass</span></span><br><span class="line"></span><br><span class="line">args = (<span class="string">"Hello"</span>, <span class="string">"Python"</span>)</span><br><span class="line"><span class="comment"># test("Niki",args)</span></span><br><span class="line">test(<span class="string">"Niki"</span>,*args)</span><br><span class="line"></span><br><span class="line"><span class="comment">#运行结果</span></span><br><span class="line">&gt;python testArgs.py</span><br><span class="line">name <span class="keyword">is</span> Niki</span><br><span class="line">非命名键值参数: Hello</span><br><span class="line">非命名键值参数: Python</span><br></pre></td></tr></table></figure></p>
<p>键值可变长参数也是类似<br><figure class="highlight python"><table><tr><td class="code"><pre><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">test2</span><span class="params">(name, **kwargs)</span>:</span></span><br><span class="line">    print(<span class="string">"name is %s"</span> % name)</span><br><span class="line">    <span class="keyword">for</span> key <span class="keyword">in</span> kwargs:</span><br><span class="line">        print(<span class="string">"键值参数中key：%s,value：%s"</span> % (key, kwargs[key]))</span><br><span class="line">    <span class="keyword">pass</span></span><br><span class="line"></span><br><span class="line">args = &#123;<span class="string">"adress"</span>:<span class="string">"sz"</span>, <span class="string">"learn"</span>:<span class="string">"python"</span>&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">#运行结果</span></span><br><span class="line">&gt; python testArgs.py</span><br><span class="line">Traceback (most recent call last):</span><br><span class="line">  File <span class="string">"testArgs.py"</span>, line <span class="number">22</span>, <span class="keyword">in</span> &lt;module&gt;</span><br><span class="line">    test2(<span class="string">"Niki"</span>, args)</span><br><span class="line">TypeError: test2() takes <span class="number">1</span> positional argument but <span class="number">2</span> were given</span><br></pre></td></tr></table></figure></p>
<figure class="highlight python"><table><tr><td class="code"><pre><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">test2</span><span class="params">(name, **kwargs)</span>:</span></span><br><span class="line">    print(<span class="string">"name is %s"</span> % name)</span><br><span class="line">    <span class="keyword">for</span> key <span class="keyword">in</span> kwargs:</span><br><span class="line">        print(<span class="string">"键值参数中key：%s,value：%s"</span> % (key, kwargs[key]))</span><br><span class="line">    <span class="keyword">pass</span></span><br><span class="line"></span><br><span class="line">args = &#123;<span class="string">"adress"</span>:<span class="string">"sz"</span>, <span class="string">"learn"</span>:<span class="string">"python"</span>&#125;</span><br><span class="line"></span><br><span class="line">test2(<span class="string">"Niki"</span>, **args)</span><br><span class="line"></span><br><span class="line"><span class="comment">#运行结果</span></span><br><span class="line">&gt; python testArgs.py</span><br><span class="line">name <span class="keyword">is</span> Niki</span><br><span class="line">键值参数中key：adress,value：sz</span><br><span class="line">键值参数中key：learn,value：python</span><br></pre></td></tr></table></figure>
<blockquote>
<blockquote>
<p>参考<br><a href="http://python.jobbole.com/83476/" target="_blank" rel="external">Python中如何使用*args和**Kwargs</a><br><a href="https://www.cnblogs.com/xudong-bupt/p/3833933.html" target="_blank" rel="external">Python中函数的参数传递与可变长参数</a></p>
</blockquote>
</blockquote>

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        

      
    </div>


    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/blog/tags/python/" rel="tag"># python</a>
          
        </div>
      

      
        
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/blog/2018/02/27/python-argparse用法总结/" rel="next" title="python argparse用法总结">
                <i class="fa fa-chevron-left"></i> python argparse用法总结
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/blog/2018/03/06/python requests框架/" rel="prev" title="python requests框架">
                python requests框架 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </article>



    <div class="post-spread">
      
    </div>
  </div>

          
          </div>
          


          
  <div class="comments" id="comments">
    
      <div id="lv-container" data-id="city" data-uid="MTAyMC8zNjY5NS8xMzIzMA=="></div>
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="/blog/images/head.jpg"
               alt="Fang ShuHao" />
          <p class="site-author-name" itemprop="name">Fang ShuHao</p>
           
              <p class="site-description motion-element" itemprop="description"></p>
          
        </div>
        <nav class="site-state motion-element">
        
          
            <div class="site-state-item site-state-posts">
              <a href="/blog/archives">
                <span class="site-state-item-count">135</span>
                <span class="site-state-item-name">日志</span>
              </a>
            </div>
          

          
            <div class="site-state-item site-state-categories">
              <a href="/blog/categories">
                <span class="site-state-item-count">35</span>
                <span class="site-state-item-name">分类</span>
              </a>
            </div>
          

          
            <div class="site-state-item site-state-tags">
              <a href="/blog/tags">
                <span class="site-state-item-count">93</span>
                <span class="site-state-item-name">标签</span>
              </a>
            </div>
          

        </nav>

        

        <div class="links-of-author motion-element">
          
        </div>

        
        

        
        

        


      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#函数参数默认缺省值"><span class="nav-number">1.</span> <span class="nav-text">函数参数默认缺省值</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#根据参数名传参"><span class="nav-number">2.</span> <span class="nav-text">根据参数名传参</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#变长函数定义"><span class="nav-number">3.</span> <span class="nav-text">变长函数定义</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#args"><span class="nav-number">3.0.1.</span> <span class="nav-text">*args</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#kwargs"><span class="nav-number">3.0.2.</span> <span class="nav-text">**kwargs</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#非命名键值参数，-键值参数"><span class="nav-number">3.0.3.</span> <span class="nav-text">非命名键值参数， 键值参数</span></a></li></ol></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#变长函数调用"><span class="nav-number">4.</span> <span class="nav-text">变长函数调用</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy; 
  <span itemprop="copyrightYear">2019</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Fang ShuHao</span>
</div>


<div class="powered-by">
  由 <a class="theme-link" href="https://hexo.io">Hexo</a> 强力驱动
</div>

<div class="theme-info">
  主题 -
  <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
    NexT.Mist
  </a>
</div>


        

        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    
    
  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  




  
  <script type="text/javascript" src="/blog/lib/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/blog/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/blog/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/blog/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/blog/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/blog/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/blog/js/src/utils.js?v=5.1.0"></script>

  <script type="text/javascript" src="/blog/js/src/motion.js?v=5.1.0"></script>



  
  

  
  <script type="text/javascript" src="/blog/js/src/scrollspy.js?v=5.1.0"></script>
<script type="text/javascript" src="/blog/js/src/post-details.js?v=5.1.0"></script>



  


  <script type="text/javascript" src="/blog/js/src/bootstrap.js?v=5.1.0"></script>



  



  




	





  





  





  
    <script type="text/javascript">
      (function(d, s) {
        var j, e = d.getElementsByTagName(s)[0];
        if (typeof LivereTower === 'function') { return; }
        j = d.createElement(s);
        j.src = 'https://cdn-city.livere.com/js/embed.dist.js';
        j.async = true;
        e.parentNode.insertBefore(j, e);
      })(document, 'script');
    </script>
  



  
  

  

  

  

  


  

</body>
</html>
